package pers.rcklos.myserver.biz.impl;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import pers.rcklos.myserver.biz.CommentBiz;
import pers.rcklos.myserver.dao.CommentDao;
import pers.rcklos.myserver.entity.CommentItem;
import pers.rcklos.myserver.entity.PaperItem;

@Service
public class CommentBizImpl implements CommentBiz {
	
	private CommentDao commentDao;
	
	public CommentBizImpl(CommentDao commentDao) {
		// TODO Auto-generated constructor stub
		setCommentDao(commentDao);
	}
	
	@Override
	public ArrayList<CommentItem> queryPageOfComments(int skipPage, int pageSize) {
		// TODO Auto-generated method stub
		return commentDao.queryPageOfComments(skipPage * pageSize, pageSize);
	}
	
	@Override
	public ArrayList<CommentItem> queryAllComments() {
		// TODO Auto-generated method stub
		return commentDao.queryAllComments();
	}
	
	@Override
	public boolean deleteCommentById(int commentId) {
		// TODO Auto-generated method stub
		return commentDao.deleteCommentById(commentId) > 0;
	}


	@Autowired
	public void setCommentDao(CommentDao commentDao) {
		this.commentDao = commentDao;
	}

}
